﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace Youtube_HD.Model
{
    public class BooleanToOpacityConverter : IValueConverter
    {
        /// <summary>
        /// Converter boolean to a opacity value.
        /// </summary>
        /// <param name="value">An object.</param>
        /// <param name="targetType">Target type.</param>
        /// <param name="parameter">Parameter object.</param>
        /// <param name="language">String object.</param>
        /// <returns>Return an object.</returns>
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            return (bool)value ? 1.0 : 0.5;
        }

        /// <summary>
        /// Convert back.
        /// </summary>
        /// <param name="value">An object.</param>
        /// <param name="targetType">Target type.</param>
        /// <param name="parameter">Parameter object.</param>
        /// <param name="language">String object.</param>
        /// <returns>Return an object.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            return 1.0;
        }

        /// <summary>
        /// Converter boolean to a opacity value.
        /// </summary>
        /// <param name="value">An object.</param>
        /// <param name="targetType">Target type.</param>
        /// <param name="parameter">Parameter object.</param>
        /// <param name="culture">CultureInfo object.</param>
        /// <returns>Return an object.</returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (bool)value ? 1.0 : 0.5;
        }

        /// <summary>
        /// Convert back.
        /// </summary>
        /// <param name="value">An object.</param>
        /// <param name="targetType">Target type.</param>
        /// <param name="parameter">Parameter object.</param>
        /// <param name="culture">CultureInfo object.</param>
        /// <returns>Return an object.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return 1.0;
        }
    }
}
